Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
Making "View" fill upp entire screen in React Native

I am working on a React-native project and stumbled upon issues when setting width and height using percentage values to a View. I have tried to set width: 100% and height: 100% but this does not work.

function CalendarPage() {
  return (
  <MainWrapper>
    <SafeAreaView style={styles.container}>
       <ScrollView>
        <StyleContentWrapper>
          <Paragraph> Hello World! </Paragraph>
        </StyleContentWrapper>
      </ScrollView>
    </SafeAreaView>
  </MainWrapper>
  );
}
const MainWrapper = styled.View`
  flex: 1; 
  justify-content: center; 
  align-items: center; 
  background-color: lightgray; 
  color: white;
`
const StyleContentWrapper = styled.View`
  height: 100%;     // this does not work
  width: 100%;      // this does not work
  background-color: red;
  padding-top: 40px;
  padding-horizontal: 20px;

`

A quick explaination for the components: MainWrapper covers the entire screen and is the base layer. The reason why it nests SafeAreaView is because this allows me to set a background color on the "safe area".

I have also nested another view called StyleContentWrapperinside a ScrollView, because I want everything inside to be scrollable.

This is the results

StyledContentWrapper or The red box does not cover the entire screen, despite having the styles of width: 100% and height: 100%. Why is this? Setting fixed width and height does work, but this is not the approach I want, because different devices has different widths and heights, and I want it to work for multiple screens with different widths and heights, hence the use of perecentage.

How can I solve this?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!